<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
		<title>msg-登录</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<link href="assets/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
		<link href="assets/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
		<link href="assets/css/style.min.css?v=4.0.0" rel="stylesheet">
		<link href="assets/css/login.min.css" rel="stylesheet">
		
		<!--[if lt IE 9]>
    		<meta http-equiv="refresh" content="0;ie.html"/><![endif]
    	-->
    	<style type="text/css">
    		.mb-15 {
    			margin-bottom: 15px;
			}
			.imageCode {
				position: relative;
				top: -27px;
				right: 5px;
				float:right;
				/* display:inline-block; */
			}
    	</style>
    	<!--init-->
		<script>
			if(window.top !== window.self) {
				window.top.location = window.location
			};
		</script>
		
		<!--地址-->
		<!-- saved from url=(0047)http://www.zi-han.net/theme/hplus/login_v2.html -->
	</head>

	<body class="signin">
		<div class="signinpanel">
			<div class="row">
				<div class="col-sm-7">
					<div class="signin-info mb-15">
						<div class="logopanel m-b">
							<h1>[ H+ ]</h1>
						</div>
						<div class="m-b"></div>
						<h4>欢迎使用 <strong>H+ 后台主题UI框架</strong></h4>
						<ul class="m-b">
							<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势一</li>
							<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势二</li>
							<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势三</li>
							<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势四</li>
							<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势五</li>
						</ul>
						<strong>
							还没有账号？
		                    <a href="zhuce.html">立即注册»</a>
		                </strong>
					</div>
				</div>
				<div class="col-sm-5">
					<div id="" class="form">
						<h4 class="no-margins">登录：</h4>
						<p class="m-t-md">登录到UI-Admin</p>
						<input type="text" class="form-control uname" placeholder="用户名" id="code" maxlength="12">
						<input type="password" class="form-control pword" placeholder="密码" id="password" maxlength="16">
						<input type="text" class="form-control pword" placeholder="图形验证码" id="imageCode" maxlength="4" style="display:inline-block;">
						<img _ngcontent-c12="" class="imageCode" src="" onclick="getImageCode()">	
						<a href="javascript:void()" style="display:block;margin-top: 10px;">忘记密码了？</a>
						<button class="btn btn-success btn-block" onclick="login()" id="but">登录</button>
					</div>
				</div>
			</div>
			<div class="signup-footer">
				<div class="pull-left">
					© 2018 All Rights Reserved. blog.sunf.top
				</div>
			</div>
			
		</div>
		
		<script type="text/javascript" src="config.js"></script>
		<script type="text/javascript" src="assets/js/jquery.min.js?v=2.1.4"></script>
		<script type="text/javascript" src="assets/js/md5.js"></script>
		<script type="text/javascript" src="assets/js/axios.min.js"></script>
		<script type="text/javascript" src="assets/js/common.js"></script>
		<script type="text/javascript" src="assets/plugins/layer/layer_v3.1.1/layer.js"></script>
		<script>
			// 登录
			function login(){
		        var code = $("#code").val()
        		var password = $("#password").val()
				var imageCode = $("#imageCode").val()
		        if(code==""){
		            layer.msg("请输入用户名！")
		            return false;
		        };
				if(password==""){
		            layer.msg("请输入密码！")
		            return false;
		        };
				if(imageCode==""){
		            layer.msg("请输入图形验证码！")
		            return false;
		        };
		        layer.load(0);
		        password = md5(password); 
				var params = {account:code, password:password, imageCode:imageCode};
				
				axios.post('/sysSecurity/login/api',params)
					.then(function (response) {
						layer.closeAll('loading');
						layer.msg(response.msg);
						if(response.result){
							var userInfo = response.data;
							localStorage.setItem("token", userInfo.token);
							localStorage.setItem("userInfo", JSON.stringify(userInfo));
							setTimeout(function(){
		            			var lastPagePath = localStorage.getItem("lastPagePath")!=null ? localStorage.getItem("lastPagePath") : "index.html";
		            			localStorage.removeItem("lastPagePath");
							 	location.href = lastPagePath;
							}, 1000);
						}else{
							getImageCode();
						};
						
					})
				
				return false;
			}
			$('#imageCode,#password').keydown(function(e) {
				if (e.keyCode == 13) {
					login();
				}
			});
			//图片验证码
			function getImageCode(){
				var url = baseURL + '/sysSecurity/getImageCode/api?t='+(new Date()).getTime()+'&sign='+sign;
				$(".imageCode").attr('src', url);	
			};
			getImageCode();
			
		</script>
		
	</body>

</html>